﻿using AutoMapper;

namespace EMall.Query
{
    public static class PagedListExtension
    {
        public static IPagedList<TDestination> Map<TSource, TDestination>(this IMapper mapper, IPagedList<TSource> source)
        {
            var items = mapper.Map<List<TDestination>>(source.Items);
            return new PagedList<TDestination>(source.PageIndex, source.PageSize, source.TotalCount, items);
        }
    }
}
